using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using Curchy.PERTToolbox.Interface;
using Curchy.PERTToolbox.PropertyGrid;

namespace Curchy.PERTToolbox.Entity
{
    public class Project : IDescriptive
    {
        private string _name;
        private string _client;
        private string _estimator;
        private DescriptiveList<Risk> _risks;
        private DescriptiveList<Activity> _tasks;
        private DescriptiveList<Assumption> _assumptions;
        private Calendar _calendar;

        public Project()
        {
            _risks = new DescriptiveList<Risk>();
            _tasks = new DescriptiveList<Activity>();
            _assumptions = new DescriptiveList<Assumption>();
        }

        [PropertyOrder(1)]
        [CategoryAttribute("Specifications")]
        [Curchy.PERTToolbox.PropertyGrid.DisplayName("Project Name")]
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        [PropertyOrder(2)]
        [CategoryAttribute("Specifications")]
        [Curchy.PERTToolbox.PropertyGrid.DisplayName("Estimator")]
        public string Estimator
        {
            get { return _estimator; }
            set { _estimator = value; }
        }

        [PropertyOrder(3)]
        [CategoryAttribute("Specifications")]
        [Curchy.PERTToolbox.PropertyGrid.DisplayName("Client")]
        public string Client
        {
            get { return _client; }
            set { _client = value; }
        }


        [PropertyOrder(4)]
        [CategoryAttribute("Schedule")]
        [Curchy.PERTToolbox.PropertyGrid.DisplayName("Project Calendar")]
        public Calendar Calendar
        {
            get { return _calendar; }
            set { _calendar = value; }
        }

        [PropertyOrder(5)]
        [CategoryAttribute("Details")]
        [Curchy.PERTToolbox.PropertyGrid.DisplayName("Activities")]
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public DescriptiveList<Activity> Activities
        {
            get { return _tasks; }
            set { _tasks = value; }
        }

        [PropertyOrder(6)]
        [CategoryAttribute("Details")]
        [Curchy.PERTToolbox.PropertyGrid.DisplayName("Risks")]
		[TypeConverter(typeof(ExpandableObjectConverter))]
        public DescriptiveList<Risk> Risks
        {
            get { return _risks; }
            set { _risks = value; }
        }

        [PropertyOrder(7)]
        [CategoryAttribute("Details")]
        [Curchy.PERTToolbox.PropertyGrid.DisplayName("Assumptions")]
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public DescriptiveList<Assumption> Assumptions
        {
            get { return _assumptions; }
            set { _assumptions = value; }
        }


        public override string ToString()
        {
            return _name;
        }


        #region IDescriptive Members

        [Browsable(false)]
        public string Description
        {
            get { return _tasks.Count.ToString() + " activities, " + _risks.Count.ToString() + " risks"; }
        }

        #endregion
    }
}
